package com.zllkj.mm.adapter

import android.util.Log
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.appcompat.widget.LinearLayoutCompat
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.zllkj.mm.R
import com.zllkj.mm.model.entity.WaitToConfirmOrderVoRecord
import com.zllkj.mm.util.common.FormatUtil
import com.zllkj.mm.util.common.PictureLoadUtil


class FreeTimeWaitToConfirmListAdapter(layoutResId: Int, data: List<WaitToConfirmOrderVoRecord?>?) :
        BaseQuickAdapter<WaitToConfirmOrderVoRecord, BaseViewHolder>(layoutResId, data) {
    override fun convert(baseViewHolder: BaseViewHolder, vm: WaitToConfirmOrderVoRecord) {
        vm?.let {
            var ivHead = baseViewHolder.getView<AppCompatImageView>(R.id.ivhead)
            baseViewHolder.getView<AppCompatTextView>(R.id.tvUserName).text = it.nikeName
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_friend_content).text = it.content
            var address = "|" + it.province + it.city + it.district
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_age_and_sex).text = if(it.sex == 1)"男" else "女"
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_age_and_sex).append(address)
            PictureLoadUtil.loadPic(ivHead,vm!!.userLogo)

            if (it.dynamicType == 1) {
                it.price?.let { price ->
                    baseViewHolder.getView<LinearLayoutCompat>(R.id.ll_invite_time_area).visibility = View.VISIBLE
                    baseViewHolder.getView<AppCompatTextView>(R.id.tv_friend_invite_money).text = FormatUtil.bigDecimalUtilFormat(vm.price.toString(), "100") + "/次"
                    baseViewHolder.getView<AppCompatTextView>(R.id.tv_friend_invite_time).text = FormatUtil.dataFormat(it.createTime)
                }
            }


        }

    }
}